﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FilmAlert.Common;
using FilmAlert.DataAccess;
using FilmAlert.Imdb;

namespace FilmAlert.BusinessLayer
{
    public class Search
    {
        /// <summary>
        /// Returns a Films object that contains results of a search on Imdb.com + the results of the SearchFilmTranslations method.
        /// </summary>
        /// <param name="filmTitle"></param>
        /// <returns></returns>
        public Films SearchFilm(String filmTitle)
        {
            Films films = new ImdbServices().SearchFilm(filmTitle);

            films.Akas = new FilmsDataAccess().SearchFilmAkas(filmTitle);

            return films;
        }

        /// <summary>
        /// Returns a Films object that contains results of a search on Imdb.com + the results of the SearchFilmTranslationsWithLanguageOption method.
        /// </summary>
        /// <param name="filmTitle"></param>
        /// <param name="languageIsoCode"></param>
        /// <returns></returns>
        public Films SearchFilmWithLanguageOption(String filmTitle, String languageIsoCode)
        {
            Films films = new ImdbServices().SearchFilm(filmTitle);

            films.Akas = new FilmsDataAccess().SearchFilmAkas(filmTitle, languageIsoCode);

            return films;
        }

        /// <summary>
        /// Returns a collection of Aka objects that contains the title translation in all languages available.
        /// </summary>
        /// <param name="filmTitle"></param>
        /// <returns></returns>
        public List<Aka> SearchFilmTranslations(String filmTitle)
        {
            return new FilmsDataAccess().SearchFilmAkas(filmTitle);
        }

        /// <summary>
        /// Returns a collection of Aka objects that contains the title translation for a given langague. The languageIsoCode parameter is given by the GetLanguages method or using the LanguageEnum.
        /// </summary>
        /// <param name="filmTitle"></param>
        /// <param name="languageIsoCode"></param>
        /// <returns></returns>
        public List<Aka> SearchFilmTranslationsWithLanguageOption(String filmTitle, String languageIsoCode)
        {
            return new FilmsDataAccess().SearchFilmAkas(filmTitle, languageIsoCode);
        }


    }
}
